package com.neusoft.neuiotms.dcom.converter.report;

import org.springframework.stereotype.Component;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcom.dto.report.ReportToolItemDTO;
import com.neusoft.neuiotms.dcom.model.report.ReportToolItem;

@Component
public class ReportToolItemConverter extends AbstractConverter<ReportToolItem, ReportToolItemDTO> {

    @Override
    public ReportToolItem toModel(final ReportToolItemDTO dto) {

        final ReportToolItem model = new ReportToolItem();

        model.setSqlCode(dto.getSqlCode());
        model.setSqlCodeType(dto.getSqlCodeType());
        model.setSqlCondition(dto.getSqlCondition());

        return model;
    }

    @Override
    public ReportToolItemDTO toDTO(final ReportToolItem model, final boolean forListView) {

        final ReportToolItemDTO dto = new ReportToolItemDTO();

        dto.setId(model.getId());
        dto.setSqlCode(model.getSqlCode());
        dto.setSqlCodeType(model.getSqlCodeType());
        dto.setSqlCondition(model.getSqlCondition());

        return dto;
    }

}
